
Security News
Next.js Patches Critical Middleware Vulnerability (CVE-2025-29927)
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
@gasket/plugin-command
Advanced tools
Plugin to enable other plugins to inject new gasket commands
This plugin enables other plugins to define and inject custom commands into the
Gasket CLI. It executes the commands
lifecycle during the configure
hook,
allowing you to extend the functionality of the Gasket CLI with custom commands.
The plugin utilizes Commander.js for command management.
npm i @gasket/plugin-command
Update your Gasket configuration to include the plugin:
import { makeGasket } from '@gasket/core';
+ import pluginCommand from '@gasket/plugin-command';
export default makeGasket({
plugins: [
// other plugins
+ pluginCommand
]
});
The commands
lifecycle is executed during the configure
hook if the gasket
CLI command is present in the argv
. You can define commands that include
arguments, options, and custom parsing logic.
Define a command with a description and an action:
export default {
name: 'example-plugin',
hooks: {
commands(gasket) {
return {
id: 'example-cmd',
description: 'Example command',
action: async () => {
console.log('Hello from example command!');
}
};
}
}
};
Execute the command:
node ./gasket.js example-cmd
# Output: Hello from example command!
Add arguments to your command using the args
array:
export default {
name: 'example-plugin',
hooks: {
commands(gasket) {
return {
id: 'example-cmd',
description: 'Example command with arguments',
args: [
{
name: 'message',
description: 'Message to display',
required: true
}
],
action: async (message) => {
console.log('Message:', message);
}
};
}
}
};
Run with arguments:
node ./gasket.js example-cmd "Hello, World!"
# Output: Message: Hello, World!
export default {
name: 'example-plugin',
hooks: {
commands(gasket) {
return {
id: 'example-cmd',
description: 'Example command with options',
options: [
{
name: 'message',
description: 'Message to display',
required: true,
short: 'm',
type: 'string'
}
],
action: async ({ message }) => {
console.log('Message:', message);
}
};
}
}
};
Run with options:
node ./gasket.js example-cmd --message "Hello, World!"
# Output: Message: Hello, World!
Use a custom parse
function to transform option values:
export default {
name: 'example-plugin',
hooks: {
commands(gasket) {
return {
id: 'example-cmd',
description: 'Example command with parsing',
options: [
{
name: 'list',
description: 'Comma-separated list of items',
required: true,
type: 'string',
parse: (value) => value.split(',')
}
],
action: async ({ list }) => {
console.log('Parsed List:', list);
}
};
}
}
};
Run with parsing:
node ./gasket.js example-cmd --list "apple,banana,orange"
# Output: Parsed List: [ 'apple', 'banana', 'orange' ]
The build
lifecycle allows plugins to hook into the application's build
process. This lifecycle is triggered by the build
command in the Gasket CLI.
Define a plugin that hooks into the build
lifecycle:
export default {
name: 'example-plugin',
hooks: {
async build(gasket) {
console.log('Running custom build logic...');
}
}
};
Run the build
command:
node ./gasket.js build
# Output:
# Running custom build logic...
For type safety, use the CommandsHook
type:
export default {
name: 'example-plugin',
hooks: {
/** @type {import('@gasket/plugin-command').CommandsHook} */
commands(gasket) {
return {
id: 'example-cmd',
description: 'Example command',
args: [
{
name: 'message',
description: 'Message to display',
required: true
}
],
action: async (message) => {
console.log('Message:', message);
}
};
}
}
};
The commands property in the gasket.js
file allows you to define configurations that are specific to individual commands. This means that when a particular command is executed, the corresponding configuration values will be applied, ensuring that each command can have its own tailored settings. This helps in managing command-specific behaviors and settings efficiently within your Gasket application.
Define a command-based configuration in the gasket.js
file:
// gasket.js
import { makeGasket } from '@gasket/core';
export default makeGasket({
message: 'Default message',
commands: {
'example-cmd': {
message: 'Hello, World!' // when the `example-cmd` command is executed, this message will be displayed
}
}
});
FAQs
Plugin to enable other plugins to inject new gasket commands
The npm package @gasket/plugin-command receives a total of 183 weekly downloads. As such, @gasket/plugin-command popularity was classified as not popular.
We found that @gasket/plugin-command demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.